﻿#ifndef LOGINWINDOW_H
#define LOGINWINDOW_H

#include "header.h"

#include "database.h"
class LoginWindow : public QWidget
{
    Q_OBJECT

public:
    explicit LoginWindow(database &db, QWidget *parent = nullptr);

signals:
    void loginSuccess(bool loggedIn, const QString &username, int userIdentity, int phoneId);
    void registrationSuccess(); // 添加注册成功信号

private slots:
    void onLoginClicked();
    void onRegisterClicked();
    void Regist();

private:
    database &db;
    QLineEdit *phoneEdit;
    QLineEdit *passwordEdit;
    QLineEdit *nameEdit;
    QLineEdit *confirmPasswordEdit;
    QPushButton *loginButton;
    QPushButton *cancelButton;
    QPushButton *registerButton;
    QSqlQuery query;
    QWidget *regiest;
};
#endif
